import Axios from 'axios'
export const creatPetUser = async(data) => {
  const res = await Axios({
    method: 'POST',
    url: '/api/admin/addpetuser',
    data: data
  })
  return res.data
}
export const getAllPetuser = (data) => {
  return Axios({
    method: 'get',
    url: '/api/admin/getAllpetuser',
    params: data
  })
}
export const getAllStore = () => {
  return Axios({
    method: 'get',
    url: '/api/admin/getStores',
  })
}
export const getAllSupplier = () => {
  return Axios({
    method: 'get',
    url: '/api/admin/getAllSupplier',
  })
}
export const deletePetUser = (_id) => {
  return Axios({
    method: 'delete',
    url: '/api/admin/' + _id
  })
}
export const petuserUpdate = (data) => {
  const { _id, address, integrate, area, name, pet, phone, status, truename } = data
  return Axios({
    method: 'patch',
    url: `/api/admin/${_id}`,
    data: {
      address, integrate, area, name, pet, phone, status, truename
    }
  })
}
export const changeStatus = (_id,params) => {
  return Axios({
    method: 'post',
    url: `/api/admin/changeStatus`,
    data: {
      _id,
      params
    }
  })
}
export const addStore = (data) => {
  return Axios({
    method: 'post',
    url: `/api/admin/addStore`,
    data
  })
}
export const addSupplier = (data) => {
  return Axios({
    method: 'post',
    url: `/api/admin/addSupplier`,
    data
  })
}
export const getDor= (_id)=>{
  return Axios({
       method:"get",
       url:"/api/admin/getDorById",
       params:data
   })
  
}
export const addAdmin=async (data)=>{
  let res=await  Axios({
      method:"POST",
      url:"/api/admin/addAdmin",
      data:data
  })
  return res.data
}
export const getAllAdmin= (data)=>{
 return Axios({
      method:"get",
      url:"/api/admin/getAllAdmin",
      params:data
  })
 
}
export const deleteAdmin= (_id)=>{
  return Axios({
       method:"post",
       url:"/api/admin/deleteAd",
       data:{_id}
   })
  
}
export const adminUpdate= (data)=>{
  const{_id,name,phone,email,adminName,adminPassword,status,power}=data
 return Axios({
      method:"patch",
      url:`/api/admin/update/${_id}`,
      data:{
          name,phone,email,adminName,adminPassword,status,power
      }
  })
}
export const getstoreById= (_id)=>{
 return Axios({
      method:"get",
      url:`/api/admin/getstore/${_id}`,
  })
}